<template>
	<view class="page pb20">

		<view class="page-content ">
			<view class="p12">

				<view class=" " v-for="(item,index) in dataList" :key="index">
					<view class="bg-white mb15 p15" style="box-shadow: 0px 8px 20px 0px rgba(230,219,209,0.25);">
						<view class="fz14 u-f-jsb u-flex bm pb15 mb8">收租日期<span class="status fz12">{{item.rentCollectionDateFormat}}</span>
						</view>
						<view v-if="houseName" class="fz13 u-f-jsb u-flex pt8 pb8">
							房源名称<span class="">{{houseName}}</span>
						</view>
						
						<view class="fz13 u-f-jsb u-flex pt8 pb8">
							业务类型<span class="">{{item.bizTypeDesc}}</span>
						</view>
						<view v-if="!houseName"  class="fz13 u-f-jsb u-flex pt8 pb8">
							收租类型<span class="">{{item.rentCollectionTypeName}}</span>
						</view>
						<view class="fz13 u-f-jsb u-flex pt8 pb8">
							租金<span class="">￥{{item.rent}}</span>
						</view>
						<view class="fz13 u-f-jsb u-flex pt8 pb8">
							实收租金<span class="">￥{{item.paidUpRent}}</span>
						</view>
						<view v-if="!houseName" class="fz13 u-f-jsb u-flex pt8 pb8">
							收益比例<span class="">{{item.ratio}}%</span>
						</view>
						<view v-if="!houseName" class="fz13 u-f-jsb u-flex pt8 pb8">
							收益金额<span class="">￥{{item.amount}}</span>
						</view>
						<view class="fz13 u-f-jsb u-flex pt8 pb8">
							审核日期<span class="">{{item.approvalTimeFormat}}</span>
						</view>
						
					</view>

				</view>
			</view>
		</view>
		<u-loadmore :status="loadStatus"></u-loadmore>


	</view>
</template>

<script>
	export default {
		data() {
			return {
				current: 0,

				cateList: [],
				loadStatus: 'more',
				scrollHeight: 300,
				dataList: [],
				type:1,
				houseName:'',
				propertyId:'',
				page: 1,
			}
		},
		onLoad(e) {
			if(e.houseName){
				this.houseName=e.houseName
			}
			this.type=e.type
			this.propertyId=e.id
			this.initData()
		},
		onShow() {},
		// 页面下拉到底部触发
		onReachBottom() {
			if (this.loadStatus == 'more') {
				this.getData()
			}
		},
		methods: {

			initData() {
				this.page = 1
				this.dataList = []
				this.getData()
			},

			getData() {
				
				let api='incomeDistrbutionList'
				if(this.type==3){
					api='incomeList'
				}else{
					api='incomeDistrbutionList'
				}
				this.$api[api]({
					pageNo: this.page,
					pageSize: 10,
					propertyId:this.propertyId,
					userType:this.type,
				}, res => {
					if (res.code) {
						let _list = res.data.list
						this.dataList = [...this.dataList, ..._list]
						// 判断所有数据是否请求完毕
						if (res.data.total > this.dataList.length) {
							this.page++
							this.loadStatus = 'more'
						} else {
							this.loadStatus = 'noMore'
						}
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.btn {
		padding: 0 30rpx;
		height: 60rpx;
		text-align: center;
		line-height: 60rpx;
		background: rgba(242, 70, 70, 0.1);
		color: #F24646;
		border-radius: 40px;

		&.btn-del {
			background: #f5f5f5;
			color: #999;
		}
	}

	.line {
		width: 750rpx;
		height: 4rpx;
		position: relative;
		top: -4rpx;
		background: #F6F9F9;
		border-radius: 0px 0px 0px 0px;
	}

	.status1 {
		color: #E54440;
	}

	.status2 {
		color: #39959B;
	}

	.status3 {
		color: #333;
	}
</style>